#pragma once

#include "glc/texture2d.h"

#include "entity/entitycontainer.h"

#include <gsl/gsl_errno.h>
#include <gsl/gsl_spline.h>

namespace Demo {

/**
 * @brief The Tile class represents strategy map cell, it contains list of
 * map objects, like army, city, building, decoration (like tree), etc.
 */
class Tile
{
public:
    Tile();
    virtual ~Tile();

    const EntityContainer &entities() const;
    EntityContainer &entities();

    /**
     * @brief hasObstacle
     * @return true if tile is impervious (containts unit or static object)
     */
    bool hasObstacle();

    /**
     * @brief ground
     * @return reference to ground texture used at this tile
     */
    GLC::Texture2DRef ground() const;

    void setGround(const GLC::Texture2DRef &ground);

    /**
      * @brief setHeight
      * Allows to set tile height
      */


    void renderQuadByLines()const;

    double f(double x, double y)const;

    double bicubic(double x,double y)const;

    void setHeight(float h,int x,int y);

    void render() const;



private:

    GLC::Texture2DRef _texture;
    EntityContainer _entities;

    float _edges_h[4][4];

};

} // namespace Demo
